package mdm.com.sap.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 转移单
 * 
 * @author Administrator
 *
 */
public class Tnote_Hdr {

    /**
     * 轉移單號
     */
    private String tnote_number;
    
    /**
     * 销售单号
     */
    private String vbeln;

    /**
     * 项目号
     */
    private String posnr;

    /**
     * 轉移單狀態
     */
    private String tnote_status;

    /**
     * 生產單號
     */
    private String ordernumber;

    /**
     * 生產車間號
     */
    private String pscode;

    /**
     * 創建日期
     */
    private String creationdate;

    /**
     * 創建人
     */
    private String createdby;

    /**
     * 最近修改日期
     */
    private String lastchangeddate;

    /**
     * 最近修改人
     */
    private String lastchangedby;

    /**
     * 客人PO
     */
    private String customer_po;

    /**
     * 客户名称
     */
    private String customer_name;

    /**
     * 客户号
     */
    private String customer_no;

    /**
     * SAP款号
     */
    private String sap_no;

    /**
     * 明细
     */
    private String total_no_of_box;

    /**
     * 总数
     */
    private String total_vemng;

    /**
     * 仓位
     */
    private String location;

    /**
     * 根据转移单查询出的HU详细信息
     */
    private List<Hu_Info> list;

    public String getTnote_number() {
        return tnote_number;
    }

    public void setTnote_number(String tnote_number) {
        this.tnote_number = tnote_number;
    }
    
    public String getPosnr() {
        return posnr;
    }

    public void setPosnr(String posnr) {
        this.posnr = posnr;
    }

    public String getVbeln() {
        return vbeln;
    }

    public void setVbeln(String vbeln) {
        this.vbeln = vbeln;
    }

    public String getTnote_status() {
        return tnote_status;
    }

    public void setTnote_status(String tnote_status) {
        this.tnote_status = tnote_status;
    }

    public String getOrdernumber() {
        return ordernumber;
    }

    public void setOrdernumber(String ordernumber) {
        this.ordernumber = ordernumber;
    }

    public String getPscode() {
        return pscode;
    }

    public void setPscode(String pscode) {
        this.pscode = pscode;
    }

    public String getCreationdate() {
        return creationdate;
    }

    public void setCreationdate(String creationdate) {
        this.creationdate = creationdate;
    }

    public String getCreatedby() {
        return createdby;
    }

    public void setCreatedby(String createdby) {
        this.createdby = createdby;
    }

    public String getLastchangeddate() {
        return lastchangeddate;
    }

    public void setLastchangeddate(String lastchangeddate) {
        this.lastchangeddate = lastchangeddate;
    }

    public String getLastchangedby() {
        return lastchangedby;
    }

    public void setLastchangedby(String lastchangedby) {
        this.lastchangedby = lastchangedby;
    }

    public String getCustomer_po() {
        return customer_po;
    }

    public void setCustomer_po(String customer_po) {
        this.customer_po = customer_po;
    }

    public String getCustomer_name() {
        return customer_name;
    }

    public void setCustomer_name(String customer_name) {
        this.customer_name = customer_name;
    }

    public String getCustomer_no() {
        return customer_no;
    }

    public void setCustomer_no(String customer_no) {
        this.customer_no = customer_no;
    }

    public String getSap_no() {
        return sap_no;
    }

    public void setSap_no(String sap_no) {
        this.sap_no = sap_no;
    }

    public String getTotal_no_of_box() {
        return total_no_of_box;
    }

    public void setTotal_no_of_box(String total_no_of_box) {
        this.total_no_of_box = total_no_of_box;
    }

    public String getTotal_vemng() {
        return total_vemng;
    }

    public void setTotal_vemng(String total_vemng) {
        this.total_vemng = total_vemng;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public List<Hu_Info> getList() {
        return list;
    }

    public void setList(List<Hu_Info> list) {
        List<Hu_Info> nlist =  new ArrayList<Hu_Info>();
        Map<String, String> map = new HashMap<String, String>();
        for(Hu_Info info : list) {
            if(map.get(info.getExidv()) == null) {
                map.put(info.getExidv(), info.getVemng());
                nlist.add(info);
            } else {
                double vemng =  Double.parseDouble(map.get(info.getExidv()));
                double new_vemng = vemng + Double.parseDouble(info.getVemng());
                map.put(info.getExidv(), String.valueOf(new_vemng));
            }
        }
        for(int i = 0; i< nlist.size(); i++) {
            if(map.get(nlist.get(i).getExidv()) != null) {
                nlist.get(i).setVemng(map.get(nlist.get(i).getExidv()));
            }
        }
        this.list = nlist;
    }
}
